package service.impl;

import dao.UserDao;
import dao.impl.UserDaoImpl;
import pojo.User;
import service.UserService;
import util.MyBatisUtil;

import java.util.List;

public class UserServiceImpl implements UserService {
  UserDao userDao=new UserDaoImpl();
  @Override
  public int addUser(User user) {
    return userDao.addUser(user);
  }

  @Override
  public User findById(Integer id) {
    return MyBatisUtil.getSession().getMapper(UserDao.class).findById(id);
  }

  @Override
  public int updateUser(User user) {
    return userDao.updateUser(user);
  }

  @Override
  public int deleteUserById(Integer id) {
    return userDao.deleteUserById(id);
  }

  @Override
  public List<User> findAll() {

    List<User> users=  userDao.findAll();
    return users;
  }




}
